/**
 * 
 */
package com.edocbase.desktop.plugins.mdiary;

import org.eclipse.draw2d.AbstractBackground;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.geometry.Insets;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.swt.graphics.Color;

/**
 * @author X61
 *
 */
public class ColorBackgroundBorder extends AbstractBackground {
	private Color bgColor = null;

	public ColorBackgroundBorder(Color bgColor) {
		super();
		this.bgColor = bgColor;
	}

	@Override
	public void paintBackground(IFigure figure, Graphics graphics, Insets insets) {
		Rectangle rect = getPaintRectangle(figure, insets);
		graphics.pushState();
		graphics.setBackgroundColor(bgColor);
		
		graphics.fillRectangle(rect);
		
		graphics.popState();
	}
	
}
